package com.kpx.app.view;

import android.content.Context;
import android.view.View;
import android.widget.GridView;
import android.widget.LinearLayout;

import com.kpx.app.R;
import com.kpx.app.adapter.PhotoAdapter;
import com.kpx.app.bean.CertificationInfoBean;
import com.kpx.app.bean.PhotoPicBean;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by Administrator on 2017/5/15.
 */

public class ViewHeadPhoto extends LinearLayout {
    private final Context context;
    @BindView(R.id.gv_show)
    GridView gvShow;
    private List<PhotoPicBean> photos = new ArrayList<>();

    public ViewHeadPhoto(Context context, CertificationInfoBean cerb) {
        super(context);
        this.context = context;
        View view = View.inflate(context, R.layout.view_head_photo_show, this);
        ButterKnife.bind(view);
        addPhotoBean(cerb.getImsAuthenRecord().getSelfieImg());
        addPhotoBean(cerb.getImsAuthenRecord().getSideImg());
        addPhotoBean(cerb.getImsAuthenRecord().getFaceImg());
        addPhotoBean(cerb.getImsAuthenRecord().getEntiretyImg());
        addPhotoBean(cerb.getImsAuthenRecord().getSideImg());
        PhotoAdapter adapter = new PhotoAdapter(context, photos, R.layout.item_photo_show, 2, false);
        gvShow.setAdapter(adapter);
    }

    private void addPhotoBean(String selfieImg) {
        PhotoPicBean p1 = new PhotoPicBean();
        p1.setImgurl(selfieImg);
        photos.add(p1);
    }
}
